Adaptive error correction in an oversampled ADC

ABSTRACT

An analog-to-digital converter (ADC) exhibiting an uncorrected non-linear transfer function receives measured analog voltage amplitudes and outputs uncorrected digital values. A calibration circuit receives each uncorrected digital value and outputs a corrected digital value. The measured analog voltage amplitudes received by the ADC and the corresponding corrected digital values output by the calibration circuit define points approximating an ideal linear transfer function of the ADC. The calibration circuit performs piecewise-linear approximation of the uncorrected transfer function and associates each uncorrected digital value with the applicable linear segment that passes through a segment endpoint on the uncorrected transfer function. The calibration circuit calculates each corrected digital value using calibration coefficients associated with the applicable linear segment, such as the slope of the linear segment. The calibration circuit determines the calibration coefficients by calculating the second derivative of the uncorrected transfer function. The calibration coefficients are stored in non-volatile memory.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of, and claims priority under 35U.S.C. § 120 from, nonprovisional U.S. patent application Ser. No.10/844,901 entitled “Adaptive Error Correction in an Oversampled ADC,”now U.S. Pat. No. 6,993,441, filed on May 12, 2004, the subject matterof which is incorporated herein by reference.

TECHNICAL FIELD

The present invention relates to analog-to-digital converters, and morespecifically to a memory-saving method of calibrating analog-to-digitalconverters.

BACKGROUND

Analog-to-digital converters (ADCs) are widely used to convert analogvoltage signals into digital output signals. ADCs are often embeddedwith other components in integrated circuits, for example, inmicrocontrollers. The performance of ADCs that are embedded inintegrated circuits is often worse than the performance of standaloneADCs with the same specification. The presence of noise on signal linesand power supply lines often results in higher signal interference andoutput errors in embedded ADCs. Another source of errors in ADCs is thenonlinearity of the transfer functions of the ADCs. Thus, calibratingembedded ADCs to correct for errors can significantly enhanceperformance.

Ideally, the Vin versus Dout transfer function of an ADC is a straightline. A linearly increasing voltage amplitude is ideally converted bythe ADC into a linearly increasing digital value. The extent to which anADC receives an analog input signal with a linearly increasing voltageamplitude and outputs digital values that do not linearly increase invalue is referred to as “integral non-linearity error” (INL error). AnADC exhibits differential non-linearity (DNL) error, the derivative ofINL error, where it outputs discontinuous digital values in response toa smoothly changing voltage input. DNL error is the extent to which thedigital values output by an ADC do not increase by steps of 1 LSB as theanalog input voltage increases gradually. An ADC ideally converts aninput of the minimum voltage into a digital value of all zeros. Theextent to which the digital output value deviates from digital zero isreferred to as “dc offset error.” An ADC ideally converts an input ofthe maximum voltage into a digital value of all ones. The extent towhich the digital output value output deviates from all digital ones isreferred to as “gain error.”

There are various known methods for calibrating ADCs to correct for gainerror, dc offset error, INL error and DNL error. In one method, theuncorrected digital output of an ADC with a nonlinear transfer functionis mapped to the ideal linear transfer function. The calibration methoddetermines a correction factor for each uncorrected digital value outputby the ADC and stores the uncorrected value and its associatedcorrection factor in a lookup table. A calibration circuit outputs acorrected digital value on the ideal linear transfer function by addingthe appropriate correction factor to each uncorrected digital valueoutput by the ADC. Valuable memory resources must be allocated to thelookup table. A calibration method that consumes less memory resourcesfor a lookup table would be particularly advantageous in an ADC that isembedded in a microcontroller.

Another calibration method involves piecewise linear segmentation. Theentire dynamic range of the uncorrected output of an ADC is divided intoequally-spaced ranges of digital values. A best-fitting linear segmentis then mapped to the distribution of digital values within in eachrange. Each uncorrected digital output value is associated with a pointon a linear segment. Correction factors are then calculated for eachpoint along each linear segment. The output of the ADC is corrected byadding to each uncorrected digital value the correction factorassociated with the closest point on the appropriate linear segment.

A calibration method that divides an uncorrected nonlinear transferfunction into segments of approximately equal length is less accuratefor segments where the uncorrected transfer function is most nonlinear.Moreover, depending on the shape of the uncorrected transfer function,calculating correction factors with additional segments does notnecessarily render the calibration more accurate. For an uncorrected,hockey-stick-shaped transfer function, for example, approximating theuncorrected transfer function with successive linear segments along thehandle does not provide a better fit than would a single linear segment.Calculating correction factors for the successive linear segments doesnot significantly improve the resolution of the ADC.

A method is sought for calibrating an analog-to-digital converter thatreduces the memory used to store correction factors and that alsoreduces any calculations that do not significantly improve theresolution of the analog-to-digital converter.

SUMMARY

An analog-to-digital converter (ADC) that exhibits an uncorrectednon-linear transfer function receives measured analog voltage amplitudesand outputs uncorrected digital values. A calibration circuit receiveseach uncorrected digital value and outputs a corrected digital value.The calibration circuit performs piecewise-linear approximation of theuncorrected non-linear transfer function and associates each uncorrecteddigital value with the applicable linear segment that passes through asegment endpoint on the uncorrected transfer function. The correcteddigital values output by the calibration circuit and the correspondingmeasured analog voltage amplitudes received by the ADC define pointsapproximating an ideal linear transfer function of the ADC. In oneembodiment, the calibration circuit is the processing unit of amicrocontroller.

The calibration circuit calculates each corrected digital value usingcalibration coefficients associated with the applicable linear segment.One calibration coefficient is the endpoint digital value of a segmentendpoint of each linear segment. Another calibration coefficient is theslope of each linear segment. The calibration circuit determines thecalibration coefficients by calculating the second derivative of theuncorrected transfer function. The segment endpoint of each linearsegment is located on the uncorrected transfer function at a localmaximum of a second derivative of the uncorrected transfer function.

The calibration coefficients are stored in non-volatile memory. Thecorrected digital values are generated using three calibrationcoefficients plus four additional calibration coefficients for eachsegment of the piecewise-linear approximation of the uncorrectedtransfer function. Thus, the calibration circuit can generate thecorrected digital values using fewer calibration coefficients than thepredetermined number of digital values into which the ADC converts themeasured analog voltage amplitudes.

A method calibrates an ADC having a non-linear transfer function byreceiving a plurality of uncorrected digital values from the ADC and byoutputting a plurality of corrected digital values that approximatelytrack the ideal linear transfer function of the ADC. The methodapproximates the non-linear transfer function with linear segments. Asegment endpoint of each linear segment is located on the non-lineartransfer function at a local maximum of the second derivative of thenon-linear transfer function. The method calculates a corrected digitalvalue for each uncorrected digital value using calibration coefficientsassociated with the linear segment applicable to the uncorrected digitalvalue. The calibration coefficients include the endpoint digital valuesof segment endpoints of each linear segment. The method stores thecalibration coefficients in non-volatile memory. In one embodiment,corrected digital values are not generated by adding a separate, storedcorrection factor to each uncorrected digital value.

Other embodiments and advantages are described in the detaileddescription below. This summary does not purport to define theinvention. The invention is defined by the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, where like numerals indicate like components,illustrate embodiments of the invention.

FIG. 1 is a simplified schematic block diagram of a calibration circuitand an analog-to-digital (ADC) converter embedded in a microcontroller.

FIG. 2 is a graph of an uncorrected, nonlinear transfer function of theADC of FIG. 1.

FIG. 3 is a flowchart of steps whereby the calibration circuit of FIG. 1calibrates the ADC of FIG. 1.

FIG. 4 is a graph of the transfer function of FIG. 2 after beingsmoothed.

FIG. 5 is a graph of the first derivative of the transfer function ofFIG. 4.

FIGS. 6A–H are graphs of derivative and absolute value functions of thefirst derivative function of FIG. 5.

FIG. 7 shows three graphs correlating input analog voltage amplitudes tocorresponding inflection points on the first derivative of FIG. 4 andthe uncorrected transfer function of FIG. 1.

FIG. 8 illustrates the uncorrected transfer function of FIG. 1 beingapproximated by three linear segments.

FIG. 9 illustrates the calculation of the slope of one linear segment ofFIG. 8.

DETAILED DESCRIPTION

Reference will now be made in detail to some embodiments of theinvention, examples of which are illustrated in the accompanyingdrawings.

FIG. 1 shows microcontroller integrated circuit 10 with a calibrationcircuit 11, an embedded sigma-delta analog-to-digital converter (ADC)12, and a non-volatile memory 13. Calibration circuit 11 has an inputbus 14 and an output bus 15. ADC 12 has an input lead 16 and an outputbus 17. ADC 12 receives a continuous analog input signal on input lead16. The continuous analog input signal comprises a plurality of measuredanalog voltage amplitudes 18.

ADC 12 oversamples the continuous analog input signal at a samplingfrequency that is at least twice as great as the frequency of the analoginput signal. Oversampling spreads quantization noise over a widefrequency range. ADC 12 converts the plurality of measured analogvoltage amplitudes 18 into a corresponding plurality of uncorrecteddigital values 19. Each of the plurality of measured analog voltageamplitudes 18 is ideally converted into one of a predetermined number ofpossible digital values. In this embodiment, measured analog voltageamplitudes 18 are ideally converted into 1024 (2¹⁰) possible 10-bitdigital values. Each uncorrected digital value 19, however, has twelvebits so that those uncorrected digital values that fall outside the 1024possible 10-bit digital states can be represented. Each uncorrecteddigital value 19 has ten regular bits, a sign bit, and an overflow bit.ADC 12 outputs the plurality of 12-bit uncorrected digital values 19onto 12-bit output bus 17.

Each measured analog voltage amplitude and the corresponding uncorrecteddigital value define a point on an uncorrected transfer function of ADC12. The uncorrected transfer function of ADC 12 is not linear. Theplurality of uncorrected digital values 19 exhibits gain error, dcoffset error, INL error and DNL error. ADC 12 would ideally convertlinearly increasing analog voltage amplitudes into linearly increasingdigital values, resulting in an ideal linear transfer function.

Calibration circuit 11 receives the plurality of uncorrected digitalvalues 19 onto input bus 14 and outputs a plurality of corrected digitalvalues 20 onto output bus 15. Calibration circuit 11 corrects for totalerror such that the plurality of measured analog voltage amplitudes 18received by ADC 12 and the corresponding plurality of corrected digitalvalues 20 output by calibration circuit 11 define points approximatingthe ideal linear transfer function of ADC 12. Thus, calibration circuit11 does not separately correct for gain error, dc offset error, INLerror and DNL error. Calibration circuit 11 generates the correcteddigital values 20 using calibration coefficients that correspond tolinear segments that approximate the plurality of uncorrected digitalvalues 19. For each measured analog voltage amplitude received by ADC12, calibration circuit 11 is capable of calculating a corrected digitalvalue to within +/− one half of the least significant bit (LSB) of thedigital value that corresponds to the measured analog voltage amplitudeon the ideal linear transfer function.

FIG. 2 is a graph of a hypothetical, uncorrected transfer function 21 ofADC 12, as well as an ideal linear transfer function 22 for ADC 12.Uncorrected transfer function 21 correlates physically measured analogvoltage amplitudes received by ADC 12 to uncorrected digital valuesoutput by ADC 12. ADC 12 outputs the uncorrected digital values as12-bit digital values. FIG. 2 shows that DC offset error causes aportion of uncorrected transfer function 21 to extend into negativedigital amplitudes. The uncorrected digital values 19 in this negativeportion of uncorrected transfer function 21 are output by ADC 12 asnegatively signed digital numbers.

FIG. 3 is a flowchart illustrating steps 23–39 of a method by whichcalibration circuit 11 receives the plurality of uncorrected digitalvalues 19 and outputs the plurality of corrected digital values 20.Calibration circuit 11 thereby calibrates uncorrected, nonlineartransfer function 21 of ADC 12 by outputting the plurality of correcteddigital values 20 that approximately track ideal linear transferfunction 22. In a first step 23, ADC 12 generates uncorrected transferfunction 21. Each point on uncorrected transfer function 21 is definedby a measured analog voltage amplitude and a corresponding uncorrecteddigital value. In an analysis mode of microcontroller 10, uncorrectedtransfer function 21 is analyzed. The analysis mode is, for example,performed during testing after production. Subsequent steps of FIG. 3are now described in relation to the functions shown in the graphs ofFIGS. 4–9.

The analysis mode consists of steps 23 through 34, in which inflectionpoints on uncorrected transfer function 21 are determined. Uncorrectedtransfer function 21 is then approximated as multiple piecewise-linearsegments, wherein the linear segments join at the inflection points ofuncorrected transfer function 21. The number of linear segments is onemore than the number of inflection points, unlike in other calibrationmethods where the number of linear segments is defined irrespective ofcharacteristics of the uncorrected transfer function.

In a step 24, uncorrected transfer function 21 is smoothed by filteringin test equipment. FIG. 4 shows the resulting smoothed, uncorrectedtransfer function 40. Step 24 is not essential to the method of FIG. 3.The smoothing of uncorrected transfer function 21 reduces the number ofclosely-spaced inflection points and, therefore, prevents short linearsegments to be used in the approximation of uncorrected transferfunction 21. Smoothing reduces the number of calibration coefficientsused in the method of FIG. 3, but also reduces the resolution of thecalibration achieved by calibration circuit 11.

In a step 25, the first derivative of the smoothed, uncorrected transferfunction 40 is determined. FIG. 5 is a graph of the first derivative(D1) 41 of smoothed, uncorrected transfer function 40. First derivative(D1) 41 depicts the change of uncorrected digital values of smoothedtransfer function 40 in relation to the change in the measured inputanalog voltage amplitude.

In a step 26, the second derivative of smoothed, uncorrected transferfunction 40 is calculated. FIG. 6B shows the second derivative (D2) 42of the smoothed, uncorrected transfer function 40. Second derivative(D2) 42 depicts the change of first derivative (D1) 41 in relation tothe change in the measured input analog voltage amplitude.

In a step 27, the absolute value of second derivative 42 of smoothed,uncorrected transfer function 40 is calculated. FIG. 6C shows theabsolute value (D2 _(ABS)) 43 of second derivative (D2) 42.

In a step 28, absolute value (D2 _(ABS)) 43 of second derivative (D2) 42is filtered to generate a smoothed function. FIG. 6D shows the smoothedabsolute value F(D2 _(ABS)) 44 of second derivative (D2) 42.

In a step 29, points on smoothed absolute value F(D2 _(ABS)) 44 arediscarded for amplitude values that fall below a first threshold 45.First threshold 45 is placed at an amplitude above the noise level ofabsolute value (D2 _(ABS)) 43 and smoothed absolute value F(D2 _(ABS))44. By lowering threshold 45 to an amplitude just above the noise level,the piecewise-linear segments approximate uncorrected transfer function21 to a resolution of less than +/−½ LSB. Therefore, calibration circuit11 can correct for DNL error that is greater than +/−½ LSB. DNL error ofgreater than +/−½ LSB would result in one bit of effective resolutionbeing lost. Further increases in DNL error would cause a missing codephenomenon.

FIG. 6E shows the portions (TH) 46 of smoothed absolute value F(D2_(ABS)) 44 that are retained above first threshold 45. A higher secondthreshold 47 is then applied to the portions (TH) 46 in order to definevalid ranges of input analog voltage in which inflection points onuncorrected transfer function 21 can be located. Two valid ranges 48–49of input analog voltage are shown in FIG. 6E.

In a step 30, the first derivative of the portions (TH) 46 of smoothedabsolute value F(D2 _(ABS)) 44 are calculated. FIG. 6F shows the firstderivative D1(TH) 50 of the portions (TH) 46. First derivative D1(TH) 50depicts the change of portions (TH) 46 in relation to the change in themeasured input analog voltage amplitude. A zero crossing signal isgenerated at the points where first derivative D1(TH) 50 crosses zero. Azero valid signal (ZERO_VALID) is generated that indicates thezero-crossing points of the zero crossing signal that fall within thevalid ranges 48–49 determined with second threshold 47.

In a step 31, the measured input analog voltage amplitudes aredetermined for the valid zero-crossing points. FIG. 6H shows aZERO_POINTS signal indicating two input analog voltage amplitudesV_(N-1) and V_(N-2) corresponding to inflection points on uncorrectedtransfer function 21.

In a step 32, the digital values of the inflection points on uncorrectedtransfer function 21 that correspond to the valid zero-crossing pointsare determined. FIG. 7 illustrates that the two input analog voltageamplitudes V_(N-1) and V_(N-2) correspond to inflection points 51–52 onfirst derivative (D1) 41 and to inflection points 53–54 on uncorrectedtransfer function 21. Inflection points 53–54 represent points at whichuncorrected transfer function 21 changes its slope by an amount greaterthan the slope changes indicated by local maxima of function 43 belowfirst threshold 45 in FIG. 6C. The digital values DATA(V_(N-1)) andDATA(V_(N-2)) of the inflection points 53–54 on uncorrected transferfunction 21 are then determined empirically in the analysis mode.

End points 55–56 on uncorrected transfer function 21 are thenempirically chosen that correspond to the ends of the dynamic range ofADC 12. Inflection points 53–54 and end points 55–56 are defined to besegment endpoints on uncorrected transfer function 21. Uncorrectedtransfer function 21 is then approximated by three linear segments thatconnect the two inflection points 53–54 and the end points 55–56.

FIG. 8 shows that uncorrected transfer function 21 is approximated bythree linear segments 57–59. Linear segment 57 joins end point 55 andinflection point 53; linear segment 58 joins inflection point 53 andinflection point 54; and linear segment 59 joins inflection point 54 andend point 56. Uncorrected transfer function 21 is a relatively smoothfunction and is accurately approximated with just three linear segments.The method of FIG. 3 approximates uncorrected transfer function 21 withfewer linear segments than would have resulted from a conventionalpiecewise-linear approximation that inserts a linear segment for eachpredetermined range of digital values. For example, where a conventionalpiecewise-linear approximation inserts a linear segment for each rangeof two hundred digital values, uncorrected transfer function 21 would beapproximated with about five linear segments. An approximation usingfive segments over equal digital ranges, as opposed to the threesegments generated by the method of FIG. 3, would involve morecalculations but would nevertheless result in poorer resolution. Themethod of FIG. 3 places the endpoints of the linear segments only atinflection points of uncorrected transfer function 21 and therebyconcentrates the linear segments in curvy areas of the uncorrectedtransfer function, which both reduces the number of calibrationcoefficients and improves resolution.

In a step 33, the slopes of ideal linear transfer function 22 and of thelinear segments 57–59 are calculated. FIG. 9 shows a portion of thegraph of FIG. 8 and illustrates the calculation of the slope of ideallinear transfer function 22 and the slope of linear segment 57. Still inthe analysis mode, the end points of ideal linear transfer function 22are empirically determined. Ideal linear transfer function 22 extendsfrom point 64 (V_(MIN), D_(MIN)) to point 65 (V_(MAX), D_(MAX)). In thisexample, V_(MIN) is zero volts and D_(MIN) is digital zero; V_(MAX) isfive volts and D_(MAX) is 1023. The slope (mREF) of ideal lineartransfer function 22 is (D_(MAX)−D_(MIN))/(V_(MAX)−V_(MIN)) or, in thisexample, 1023/5 volts. End point 53 of linear segment 57 has thecoordinates (V_(N-1), DATA(V_(N-1))). End point 55 has the coordinates(V_(N), DATA (V_(N))). Thus, the slope (mK) of linear segment 57 is[DATA (V_(N))−DATA (V_(N-1))]/(V_(N)−V_(N-1)).

In step 33, the digital values of points 60–63 on ideal linear transferfunction 22 are also determined empirically. Points 60–63 have the samex-coordinates (analog voltage) as do end point 55, inflection points53–54 and end points 56, respectively. For example, the digital value ofpoint 62 with an x-coordinate of V_(N-1) is empirically determined tohave a digital value of REF(N−1).

In a last step 34 of the analysis mode, certain calibration coefficientsare stored in non-volatile memory 13. Non-volatile memory 13 can be, forinstance, EEPROM or FLASH memory. The slope (mREF) of ideal lineartransfer function 22, the digital value DATA(V_(N)) of the upperendpoint 55 of the highest linear segment 57, as well as D_(MIN), arestored in non-volatile memory 13. Moreover, four additional calibrationcoefficients are stored for each segment of the piecewise-linearapproximation of uncorrected transfer function 21. For linear segment57, for example, V_(N-1), DATA(V_(N-1)), mK and REF(N−1) are stored,where REF(N−1) is the digital value of the point on ideal lineartransfer function 22 that corresponds to endpoint 53 of linear segment57. V_(N-1) is stored as a digital number. Where uncorrected transferfunction 21 has been approximated by three linear segments, as shown inFIG. 8, fifteen calibration coefficients are stored in non-volatilememory 13 of microcontroller 10. Thus, considerably less memory is usedin the calibration method of FIG. 3 than is used in conventionalcalibration methods that store a correction factor in memory for eachuncorrected digital value output by an analog-to-digital converter thatis to be calibrated.

A correction mode consists of steps 35 through 39, in which calibrationcircuit 11 receives the plurality of uncorrected digital values 19 anduses the calibration coefficients determined in the analysis mode togenerate the plurality of corrected digital values 20. The analysis modeis used in the actual operation of microcontroller 10.

In a step 35, calibration circuit 11 receives the plurality ofuncorrected digital values 19 from ADC 12, including an uncorrecteddigital value DATA(V_(K)). The uncorrected digital value DATA(V_(K)) anda corresponding measured analog voltage amplitude V_(K) define a point66 on uncorrected transfer function 21.

In a step 36, calibration circuit 11 associates uncorrected digitalvalue DATA(V_(K)) with linear segment 57 and endpoint 53. Calibrationcircuit 11 associates uncorrected digital value DATA(V_(K)) with linearsegment 57 by determining that uncorrected digital value DATA(V_(K)) isless than or equal to DATA(V_(N)) and greater than DATA(V_(N-1)).

In a step 37, a digital difference ΔDATA(K) is determined by subtractingthe digital value DATA(V_(N-1)) of endpoint 53 from the uncorrecteddigital value DATA(V_(K)). Then in a step 38, the voltage differenceΔV(K) between the measured analog voltage amplitude V_(K) and the analogvoltage amplitude V_(N-1) of endpoint 53 is calculated digitally usingthe slope mK of linear segment 57. The voltage difference ΔV(K) iscalculated as the digital difference ΔDATA(K) divided by the slope mK.As point 66 on uncorrected transfer function 21 may not lie exactly onlinear segment 57, the voltage difference ΔV(K) is an approximation ofthe actual voltage difference between the measured analog voltageamplitude V_(K) and the analog voltage amplitude V_(N-1) of endpoint 53.

In a final step 39, a corrected digital value REF(K) is determined.REF(K) is the digital value approximately on ideal linear transferfunction 22 that corresponds to measured analog voltage amplitude V_(K).Corrected digital value REF(K) is calculated by extrapolation from point62 on ideal linear transfer function 22. Corrected digital value REF(K)is calculated as the voltage difference ΔV(K) multiplied by the slopemREF, plus the digital value REF(N−1) of point 62. FIG. 9 shows a point67 that lies approximately on ideal linear transfer function 22 and hasthe coordinates (V_(K), REF(K)).

Calibration circuit 11 calculates and outputs a corrected digital valuefor each uncorrected digital value received. Thus, calibration circuit11 outputs the plurality of corrected digital values 20 thatapproximately track ideal linear transfer function 22. Each of thecorrected digital values 20 fall within the digital range (D_(MIN) toD_(MAX)) of ideal linear transfer function 22 and can be expressed as a10-bit digital value. Thus, no sign bit or overflow bit is required, andthe plurality of corrected digital values 20 can be output onto 10-bitoutput bus 15.

In one embodiment, calibration circuit 11 is part of a processing unitof microcontroller 10. Microcontroller 10 is, for example, a Z8 Encore!microcontroller manufactured by Zilog, Inc. The calculations of steps24–39 are performed by an arithmetic and logical unit (ALU) within theprocessing unit of microcontroller 10. In another embodiment, thecalculations of steps 24–39 are performed in a hardwired calibrationcircuit separate from the processing unit. The hardwired calibrationcircuit can be a state machine or engine.

Although the present invention has been described in connection withcertain specific embodiments for instructional purposes, the presentinvention is not limited thereto. Although steps 24 through 34 of theanalysis mode are described above as being performed during testing ofmicrocontroller 10, the calibration coefficients can be recalculatedbefore each use of ADC 12. Determining updated calibration coefficientsprior to each use of ADC 12 can correct for such factors as the currenttemperature of microcontroller 10, a lowered maximum voltage V_(MAX)output by the power source of microcontroller 10 and changingcharacteristics of components of microcontroller 10 caused by aging.Accordingly, various modifications, adaptations, and combinations ofvarious features of the described embodiments can be practiced withoutdeparting from the scope of the invention as set forth in the claims.

1. An integrated circuit comprising: (a) an analog-to-digital converterthat converts a measured analog voltage amplitude to an uncorrecteddigital value, wherein the measured analog voltage amplitude and theuncorrected digital value define a point on an uncorrected transferfunction of the analog-to-digital converter, and wherein the uncorrectedtransfer function has a second derivative; and (b) a calibration circuitthat receives the uncorrected digital value and outputs a correcteddigital value, wherein the uncorrected digital value is associated witha linear segment that passes through a segment endpoint on theuncorrected transfer function, wherein the segment endpoint is locatedon the uncorrected transfer function at a local maximum of the secondderivative of the uncorrected transfer function, wherein the segmentendpoint has an endpoint digital value, and wherein the calibrationcircuit calculates the corrected digital value by subtracting theendpoint digital value from the uncorrected digital value.
 2. Theintegrated circuit of claim 1, wherein the calibration circuit is aprocessing unit in a microcontroller.
 3. The integrated circuit of claim1, wherein the endpoint digital value is stored in a memory location ofa non-volatile memory, wherein the analog-to-digital converter convertsa number of measured analog voltage amplitudes to a corresponding numberof uncorrected digital values, wherein the calibration circuit receivesthe number of uncorrected digital values and outputs a correspondingnumber of corrected digital values, and wherein the non-volatile memoryhas fewer memory locations than the number of corrected digital values.4. The integrated circuit of claim 1, wherein the local maximum of thesecond derivative of the uncorrected transfer function has a magnitudegreater than a threshold noise level.
 5. The integrated circuit of claim1, wherein the linear segment has a slope, and wherein the calibrationcircuit calculates the corrected digital value using the slope.
 6. Theintegrated circuit of claim 1, wherein the analog-to-digital converterconverts a plurality of measured analog voltage amplitudes to acorresponding plurality of uncorrected digital values, wherein thecalibration circuit receives the plurality of uncorrected digital valuesand generates a corresponding plurality of corrected digital values, andwherein each of the plurality of corrected digital values is notgenerated by adding a stored correction factor to each of the pluralityof uncorrected digital values.
 7. A method comprising: (a) receiving anuncorrected digital value, wherein the uncorrected digital value and ameasured analog voltage amplitude define a point on an uncorrectedtransfer function of an analog-to-digital converter, and wherein theuncorrected transfer function has a second derivative; (b) associatingthe uncorrected digital value with a linear segment that passes througha segment endpoint on the uncorrected transfer function, wherein thesegment endpoint is located on the uncorrected transfer function at alocal maximum of the second derivative of the uncorrected transferfunction, and wherein the segment endpoint has an endpoint digitalvalue; and (c) outputting a corrected digital value corresponding to themeasured analog voltage amplitude, wherein the corrected digital valueis determined using the endpoint digital value.
 8. The method of claim7, wherein the corrected digital value is determined by subtracting theendpoint digital value from the uncorrected digital value.
 9. The methodof claim 7, further comprising, before (a): (d) determining the endpointdigital value of the segment endpoint during production.
 10. The methodof claim 7, further comprising: (d) storing the endpoint digital valuein a non-volatile memory, wherein the non-volatile is in amicrocontroller.
 11. The method of claim 7, further comprising, before(a): (d) calculating the second derivative of the uncorrected transferfunction.
 12. The method of claim 7, further comprising: (d) calculatinga slope of the linear segment, wherein the corrected digital value isdetermined using the slope of the linear segment.
 13. The method ofclaim 7, further comprising: (d) receiving a second uncorrected digitalvalue, wherein the second uncorrected digital value and a secondmeasured analog voltage amplitude define a second point on theuncorrected transfer function; (e) associating the second uncorrecteddigital value with the linear segment; and (f) outputting a secondcorrected digital value corresponding to the second measured analogvoltage amplitude, wherein the second corrected digital value isdetermined using the endpoint digital value.
 14. The method of claim 7,wherein the analog-to-digital converter converts multiple measuredanalog voltage amplitudes to multiple corresponding uncorrected digitalvalues, wherein multiple corrected digital values corresponding to themultiple measured analog voltage amplitudes are output, and wherein eachof the multiple corrected digital values is determined using theendpoint digital value.
 15. The method of claim 7, wherein amicrocontroller comprises the analog-to-digital converter, and whereinthe endpoint digital value is stored in the microcontroller.
 16. Adevice comprising: (a) an analog-to-digital converter that converts ameasured analog voltage amplitude to an uncorrected digital value,wherein the measured analog voltage amplitude and the uncorrecteddigital value define a point on an uncorrected transfer function of theanalog-to-digital converter, wherein the uncorrected digital value isassociated with a linear segment that passes through a segment endpointon the uncorrected transfer function, wherein the uncorrected transferfunction has a second derivative, wherein the segment endpoint islocated at a local maximum of the second derivative of the uncorrectedtransfer function, and wherein the segment endpoint has an endpointdigital value; and (b) means for receiving the uncorrected digital valueand for outputting a corrected digital value, wherein the meansdetermines the corrected digital value using the endpoint digital value.17. The device of claim 16, wherein the means calculates the correcteddigital by subtracting the endpoint digital value from the uncorrecteddigital value.
 18. The device of claim 16, wherein the linear segmenthas a slope, and wherein the means determines the corrected digitalvalue using the slope.
 19. A device comprising: (a) an analog-to-digitalconverter that converts a measured analog voltage amplitude to anuncorrected digital value, wherein the measured analog voltage amplitudeand the uncorrected digital value define a point on an uncorrectedtransfer function of the analog-to-digital converter, wherein theuncorrected transfer function has a number of inflection points; and (b)means for receiving the uncorrected digital value and for determining acorrected digital value, wherein the means approximates the uncorrectedtransfer function as a number of linear segments, wherein the linearsegments join at the inflection points of the uncorrected transferfunction, and wherein the number of linear segments is one more than thenumber of inflection points.
 20. The device of claim 19, wherein theuncorrected digital value is associated with one of the number of linearsegment, wherein the one of the number of linear segments passes througha segment endpoint on the uncorrected transfer function, wherein thesegment endpoint is located at one of the number of inflection points,wherein the segment endpoint has an endpoint digital value, and whereinthe means determines the corrected digital value using the endpointdigital value.
 21. The device of claim 20, further comprising: (c) anon-volatile memory, wherein the endpoint digital value is stored in thenon-volatile memory.